package com.isorf.controller;
import com.isorf.test.dog;
import com.isorf.test.homework;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController

public class Testcontroller {

    @Autowired
    private dog dog;


    @GetMapping("/test")
    public String test()
    {

        //静态方法的调用
        int a = dog.aaa();
        //调用成员方法
        //A、调用无参的构造方法实例化对象
        dog dogog = new dog("小黄", 5, "雄性");
        dog.name = "小黄";
        //2、对象名.方法名调用
        String b = dog.show();

        //B、调用有参的构造方法实例化对象
        dog dog1 = new dog("大黄", 10, "男");

        homework hw =new homework();
        //三角面积
        double zhouchang = hw.calculateTriangleArea(3,3);
        // 调用计算正方形面积的方法
        double squareArea = hw.calculateSquareArea(4.0);
        System.out.println("边长为4的正方形面积为: " + squareArea);
        // 调用计算1-10的和的方法
        int sum = hw.calculateSum();
        System.out.println("1到10的和为: " + sum);
        // 调用计算梯形面积的方法
        double trapezoidArea = hw.calculateTrapezoidArea(3.0, 5.0, 4.0);
        System.out.println("上底为3，下底为5，高为4的梯形面积为: " + trapezoidArea);

        return a + b + "name："+ dog.name  + "dog1:name" + dog1.name+"\n";


    }

}
